#include<bits/stdc++.h>
using namespace std;
const int N = 500001;

int n,m;
vector<pair<int,int> > edges[N]; //e_num v

int dfn[N],low[N],tot=0;
bool insta[N];
stack<int> sta;
int scc[N],siz[N],stot;
vector<vector<int>> ans;

void tarjan(int u,int cur){
    dfn[u] = low[u] = ++tot;
    sta.push(u);
    insta[u] = true;
    for(auto v:edges[u]){
        if(v.first==(cur^1)) continue;
        if(!dfn[v.second]){
            tarjan(v.second,v.first);
            low[u] = min(low[u],low[v.second]);
        }
        else{
            low[u] = min(low[u],dfn[v.second]);
        }
    }
    if(dfn[u]==low[u]){
        stot++;
        int y;
        vector<int> vec;
        do{
            y = sta.top();
            vec.emplace_back(y);
            sta.pop();
            insta[y] = false;
            scc[y] = stot;
            siz[stot]++;
        }while(y!=u);
        ans.emplace_back(vec);
    }
}

int main(){
    scanf("%d%d",&n,&m);
    int egnum = 0;
    for(int i=1;i<=m;i++){
        int s,t;
        scanf("%d%d",&s,&t);
        edges[s].emplace_back(make_pair(i*2,t));
        edges[t].emplace_back(make_pair(i*2+1,s));
    }
    memset(dfn,0,sizeof(dfn));
    memset(low,0x7f,sizeof(low));
    for(int i=1;i<=n;i++){
        if(!dfn[i]) tarjan(i,0);
    }
    printf("%d\n",stot);
    for(int i=0;i<ans.size();i++){
        printf("%d",ans[i].size());
        for(int j=0;j<ans[i].size();j++){
            printf(" %d",ans[i][j]);
        }
        printf("\n");
    }
    return 0;
}